<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
		<style type="text/css">
			#chartsTable td.bgColor {
		    background-color: #ffffff;
		    color: #30a1f0;
		}
		
		.hongbo{
		  	background-color: #f45959;
		    border-radius: 50%;
			color: #fff;
			width:25px;
			height: 25px;
			display: flex;
		    margin: 0 auto;
		    -ms-flex-pack: center;
		    justify-content: center;
		    -ms-flex-align: center;
		    align-items: center;
		}
		
		.hb{
			background-color: #f45959;
		  	border:1px solid #f45959;
		}
		
		.lanbo{
			background-color: #51abf0;
		    border-radius: 50%;
			color: #fff;
			width:25px;
			height: 25px;
			display: flex;
		    margin: 0 auto;
		    -ms-flex-pack: center;
		    justify-content: center;
		    -ms-flex-align: center;
		    align-items: center;
		}
		
		.lanb{
			background-color: #51abf0;
			border:1px solid #51abf0;
		}
		.lvbo{
			background-color: #6acc7b;
		    border-radius: 50%;
			color: #fff;
			width:25px;
			height: 25px;
			display: flex;
		    margin: 0 auto;
		    -ms-flex-pack: center;
		    justify-content: center;
		    -ms-flex-align: center;
		    align-items: center;
		}
		
		.lvb{
			background-color: #6acc7b;
			border:1px solid #6acc7b;
		}
		
		
		</style>
<main class="outline" id="container"><div class="" id="bodyDiv">
    <div class="main  zoushi">
        <div class="zoushi_header_nav">
            <!--彩种分类-->
            <div class="lotteryNav">
                <ul>
                <li class="liDiv ssc" nid="1">
	              <div class="navTitle">
	              <i>
	                <img src="/pc-static/img/caizhong/58832d203d8bd.png" alt="" width="26px" height="26px">
	              </i>
	                <span>
	                  <a>时时彩</a>
	                </span>
	              </div>
	            </li><li class="liDiv kuai3" nid="2">
	              <div class="navTitle">
	              <i>
	                <img src="/pc-static/img/caizhong/58832d17e5110.png" alt="" width="26px" height="26px">
	              </i>
	                <span>
	                  <a>快3</a>
	                </span>
	              </div>
	            </li><li class="liDiv 115" nid="3">
	              <div class="navTitle">
	              <i>
	                <img src="/pc-static/img/caizhong/58832d0eb40b0.png" alt="" width="26px" height="26px">
	              </i>
	                <span>
	                  <a>11选5</a>
	                </span>
	              </div>
	            </li><li class="liDiv ssl" nid="4">
	              <div class="navTitle">
	              <i>
	                <img src="/pc-static/img/caizhong/58832d05dd133.png" alt="" width="26px" height="26px">
	              </i>
	                <span>
	                  <a>低频彩</a>
	                </span>
	              </div>
	            </li><li class="liDiv pk10" nid="5">
	              <div class="navTitle">
	              <i>
	                <img src="/pc-static/img/caizhong/58832cfb18d58.png" alt="" width="26px" height="26px">
	              </i>
	                <span>
	                  <a>PK10</a>
	                </span>
	              </div>
	            </li><li class="liDiv pcdd" nid="6">
	              <div class="navTitle">
	              <i>
	                <img src="/pc-static/img/caizhong/58832ced965e5.png" alt="" width="26px" height="26px">
	              </i>
	                <span>
	                  <a>PC蛋蛋</a>
	                </span>
	              </div>
	            </li><li class="liDiv kl10f" nid="7">
	              <div class="navTitle">
	              <i>
	                <img src="/pc-static/img/caizhong/58832ced965e5.png" alt="" width="26px" height="26px">
	              </i>
	                <span>
	                  <a>快乐十分</a>
	                </span>
	              </div>
	            <li class="liDiv lhc" nid="8">
	              <div class="navTitle">
	              <i>
	                <img src="/pc-static/img/caizhong/599aa83b6da0d.png" alt="" width="26px" height="26px">
	              </i>
	                <span>
	                  <a>六合彩</a>
	                </span>
	              </div>
	            </li></ul>
            </div>
           </div>
    </div>

    <div class="codeNav main">
        <a class="" id="1">今天</a><a class="" id="2">昨天</a><a class="" id="3">前天</a><a class="active" id="20">最近20期</a><a class="" id="30">最近30期</a><a class="" id="50">最近50期</a><a class="" id="100">最近100期</a>
    </div>
    <div class="chart-bg">
        <div class="regular-chart" >
                <table border="1" id="chartsTable" border="0" cellpadding="0" cellspacing="1">
                	<thead>
                		<tr class="th">
                			
                		</tr>
                		<tr>
                		</tr>
                	</thead>
                	<tbody>
	 			    </tbody>
	      <!--     <tr class="tb">
	      <td nowrap="">出现总次数</td>
	      <td align="center" colspan="5"></td><td align="center">2</td><td align="center">3</td><td align="center">2</td><td align="center">5</td><td align="center">0</td><td align="center">0</td><td align="center">4</td><td align="center">2</td><td align="center">1</td><td align="center">1</td><td align="center">2</td><td align="center">1</td><td align="center">4</td><td align="center">0</td><td align="center">2</td><td align="center">3</td><td align="center">3</td><td align="center">3</td><td align="center">0</td><td align="center">2</td><td align="center">1</td><td align="center">1</td><td align="center">5</td><td align="center">1</td><td align="center">2</td><td align="center">3</td><td align="center">0</td><td align="center">4</td><td align="center">2</td><td align="center">1</td><td align="center">1</td><td align="center">3</td><td align="center">3</td><td align="center">3</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">3</td><td align="center">3</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">2</td><td align="center">2</td><td align="center">1</td><td align="center">4</td><td align="center">2</td><td align="center">3</td><td align="center">2</td><td align="center">2</td></tr><tr class="tb">
	      <td nowrap="">平均遗漏值</td>
	      <td align="center" colspan="5">
	    </td><td align="center">9</td><td align="center">6</td><td align="center">9</td><td align="center">3</td><td align="center">20</td><td align="center">20</td><td align="center">4</td><td align="center">9</td><td align="center">19</td><td align="center">19</td><td align="center">9</td><td align="center">19</td><td align="center">4</td><td align="center">20</td><td align="center">9</td><td align="center">6</td><td align="center">6</td><td align="center">6</td><td align="center">20</td><td align="center">9</td><td align="center">19</td><td align="center">19</td><td align="center">3</td><td align="center">19</td><td align="center">9</td><td align="center">6</td><td align="center">20</td><td align="center">4</td><td align="center">9</td><td align="center">19</td><td align="center">19</td><td align="center">6</td><td align="center">6</td><td align="center">6</td><td align="center">19</td><td align="center">19</td><td align="center">19</td><td align="center">6</td><td align="center">6</td><td align="center">19</td><td align="center">19</td><td align="center">19</td><td align="center">9</td><td align="center">9</td><td align="center">19</td><td align="center">4</td><td align="center">9</td><td align="center">6</td><td align="center">9</td><td align="center">9</td></tr><tr class="tb">
	      <td nowrap="">最大遗漏值</td>
	      <td align="center" colspan="5">  
	    </td><td align="center">10</td><td align="center">11</td><td align="center">11</td><td align="center">7</td><td align="center">20</td><td align="center">20</td><td align="center">7</td><td align="center">10</td><td align="center">17</td><td align="center">15</td><td align="center">10</td><td align="center">12</td><td align="center">7</td><td align="center">20</td><td align="center">8</td><td align="center">9</td><td align="center">10</td><td align="center">9</td><td align="center">20</td><td align="center">16</td><td align="center">13</td><td align="center">12</td><td align="center">7</td><td align="center">13</td><td align="center">15</td><td align="center">11</td><td align="center">20</td><td align="center">11</td><td align="center">13</td><td align="center">17</td><td align="center">15</td><td align="center">6</td><td align="center">12</td><td align="center">11</td><td align="center">11</td><td align="center">12</td><td align="center">14</td><td align="center">11</td><td align="center">10</td><td align="center">19</td><td align="center">10</td><td align="center">15</td><td align="center">8</td><td align="center">11</td><td align="center">14</td><td align="center">13</td><td align="center">16</td><td align="center">12</td><td align="center">10</td><td align="center">11</td></tr><tr class="tb">
	      <td nowrap="">最大连出值</td>
	      <td align="center" colspan="5">
	    </td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">2</td><td align="center">0</td><td align="center">0</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">0</td><td align="center">1</td><td align="center">1</td><td align="center">2</td><td align="center">1</td><td align="center">0</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">3</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">0</td><td align="center">2</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">1</td><td align="center">2</td><td align="center">1</td><td align="center">2</td><td align="center">1</td><td align="center">1</td></tr> -->
		    
	    		 
			     <tfoot>
			     	<tr class="th">
			    		
				     </tr>
				     <tr>
                	</tr>
			     </tfoot>
	 	 </table>
	 	 <div class="canvasPaPa">
	 	 	<canvas id="canvas_div" class="moda" width="2337" height="881"></canvas>
	 	 </div>
        </div>
    </div>
</main>
</div>
<script>
/* var cname=getUrlParam('cname'); */
console.log(cname,'cname的值')
var width
var height
var index=4
bindCaiZhongjl()
var isReal=false
$.ajax({
	url: "/syLotterr.do",
	type: "post",
	data: {},
	success: function(data) {
		var cname1
			$("div").data("newData",data)
			var $noticeList = $(".zoushi_header_nav") 
			  var html=
					  "<div class='hideNav'>"+
		                   "<ul>"
		      if(cname.indexOf("ssc")!=-1){
		    	  $(".lotteryNav").find(".ssc").addClass("active")
		    	  cname1="ssc"
		      }else if(cname.indexOf("k3")!=-1){
		    	  $(".lotteryNav").find(".kuai3").addClass("active")
		    	  cname1="kuai3"
		      }else if(cname.indexOf("pk10")!=-1 || cname=="xyft" || cname=="xysm" || cname=="2fft"){
		    	  $(".lotteryNav").find(".pk10").addClass("active") 
		    	  cname1="pk10"
		      }else if(cname.indexOf("11x5")!=-1){
		    	  $(".lotteryNav").find(".115").addClass("active")
		    	  cname1="115"
		      }else if(cname=="fc3d" || cname=="pl3" || cname=="shssl"){
		    	  $(".lotteryNav").find(".ssl").addClass("active")  
		    	  cname1="ssl"
		      }else if(cname.indexOf("kl10f")!=-1){
		    	  $(".lotteryNav").find(".kl10f").addClass("active")  
		    	  cname1="kl10f"
		      }else if(cname.indexOf("6hc")!=-1){
		    	  $(".lotteryNav").find(".lhc").addClass("active")
		    	  cname1="lhc"
		      }else if(cname.indexOf("28")!=-1){
		    	  $(".lotteryNav").find(".pcdd").addClass("active")
		    	  cname1="pcdd"
		      }
			for(var i = 0;i <data.data.length;i++){
				 var item=data.data[i].cname
				var arr = data.data[i].classt.split(" ")
				if($(".lotteryNav").find(".active").legnth==1){
					 if($(".lotteryNav").find(".active").attr("class").split(" ")[1]==arr[2]){
							html += newActiveItem(data.data[i])
						} 
				}
			}
			 html+="</ul></div>"
		     $noticeList.append(html) 
		      $(".hideNav li").find("."+cname).addClass("active") 
		     bindLotterSwith()
	},
	error: function(status) {
		showNormalNoticeModal("#div-i-noticeGenDan", "提示：", "网络繁忙")
	}
})
var weishu
var start
var haoma
function bindCaiZhongjl(){
	$.ajax({
		url: "/datas/findTrend.do",
		type: "post",
		data: {"cname":cname,"type":index},
		success: function(data) {
			var html="";
			var html1="";
			var html2="";
			var total=0;
			var size;
			var oddEven;
			var boson;
			var extreme;
			var leopard;
			var hongbo = ['1', '2', '7', '8', '12', '13','18', '19', '23', '24'];
			var lanbo = ['3', '4', '9', '10', '14', '15', '20', '25', '26'];
			var lvbo= ['0','5', '6', '11','16', '17', '21', '22', '27'];
			$("thead").find("tr").eq(0).html("")
			$("thead").find("tr").eq(1).html("")
			$("tbody").html("")
			$("tfoot").find("tr").eq(0).html("")
			$("tfoot").find("tr").eq(1).html("")
			if(cname.indexOf("kl10f")==-1 && cname.indexOf("6hc")==-1){
				if(cname.indexOf("ssc")!=-1){
					weishu=["万位","千位","百位","十位","个位"]
					start=0
					haoma=10
					
				}
				if(cname.indexOf("11x5")!=-1){
					weishu=["万位","千位","百位","十位","个位"]
					start=1
					haoma=12
				}
				
				if(cname.indexOf("k3")!=-1){
					weishu=["百位","十位","个位"]
					start=1
					haoma=7
				}
				
				if(cname=="pl3" || cname=="shssl" || cname=="fc3d"){
					weishu=["百位","十位","个位"]
					start=0
					haoma=10
				}
				if(cname.indexOf("28")!=-1){
					weishu=["百位","十位","个位"]
					start=0
					haoma=10
				}
				
				if(cname.indexOf("pk10")!=-1 || cname=="xyft" || cname=="2fft" || cname=="xysm" || cname=="2fft"){
					weishu=["一位","二位","三位","四位","五位","六位","七位","八位","九位","十位"]
					start=1
					haoma=11
				}
					for(i=0;i<weishu.length;i++){
							html+="<td rowspan='1' colspan='"+Number(haoma-start)+"'>"+weishu[i]+"</td>"
						for(j=start;j<haoma;j++){
								html1+="<td class='wdh'>"+j+"</td>"
						}
					} 
					if(cname.indexOf("28")!=-1){
						$("thead").find("tr").eq(0).append("<td rowspan='2' class='jiangqi'>期号</td><td rowspan='2' colspan='"+weishu.length+"'>开奖号码</td><td rowspan='2'>和值</td>")
						$("tfoot").find("tr").eq(0).append("<td rowspan='2' class='jiangqi'>期号</td><td rowspan='2' colspan='"+weishu.length+"'>开奖号码</td><td rowspan='2'>和值</td>")	 
					}else{
						$("thead").find("tr").eq(0).append("<td rowspan='2' class='jiangqi'>期号</td><td rowspan='2' colspan='"+weishu.length+"'>开奖号码</td>")
						$("tfoot").find("tr").eq(0).append("<td rowspan='2' class='jiangqi'>期号</td><td rowspan='2' colspan='"+weishu.length+"'>开奖号码</td>")	
					}
						
						
					var num=0;
					for(i=0;i<data.data.length;i++){
						num=i
						num++
						var lotternumber=data.data[i].lotternumber; 
						lotternumber=lotternumber.split(",")
						html2+="<tr><td class='issue'><div class='issueinfo'>"+data.data[i].period+"</div></td>"
							for(j=0;j<weishu.length;j++){
								if(cname.indexOf("28")!=-1){
									total=Number(lotternumber[0])+Number(lotternumber[1])+Number(lotternumber[2])
								}
								html2+="<td align='center' class='codetd'><div class='historycode'>"+lotternumber[j]+"</div></td>"
							}
						
						if(cname.indexOf("28")!=-1){
							if(hongbo.indexOf(total+"")!=-1){
								html2+="<td align='center' class='codetd'><div class='historycode'>"+total+"</div></td>"
							}else if(lvbo.indexOf(total+"")!=-1){
								html2+="<td align='center' class='codetd'><div class='historycode lvb'>"+total+"</div></td>"
							}else if(lanbo.indexOf(total+"")!=-1){
								html2+="<td align='center' class='codetd'><div class='historycode lanb'>"+total+"</div></td>"
							}
						} 
							for(j=0;j<weishu.length;j++){
								for(z=start;z<haoma;z++){
										 if(lotternumber[j]==z){
											if(j%2==0){
												html2+="<td class='charball td0' align='center'>"+
										           "<div class='ball01 "+weishu[j]+"'>"+z+"</div>"+
											    "</td>"
											}else{
												html2+="<td class='charball td0' align='center'>"+
										           "<div class='ball01 ball01_yellow "+weishu[j]+"'>"+z+"</div>"+
											    "</td>"
											}
										}else{
											html2+="<td class='wdh td0' align='center'>"+
									           " <div class='ball13 noWin'>"+num+"</div>"+
										          "</td>"
										}
								}
							}
							 if(cname.indexOf("28")!=-1){
								if(total%2==0){
									oddEven="双"
								}else{
									oddEven="单"
								}
								if(total>=0 && total<14){
									size="小"
								}else if(total>13 && total<28){
									size="大"
								}
								if(hongbo.indexOf(total+"")!=-1){
									boson="红波"
								}else if(lanbo.indexOf(total+"")!=-1){
									boson="蓝波"
								}else if(lvbo.indexOf(total+"")!=-1){
									boson="绿波"
								}
								if(total>=0 && total<=5){
									extreme="小"
								}else if(total>=22 && total<=27){
									extreme="大"
								}else{
									extreme=""
								}
								if(lotternumber[0]==lotternumber[1]&&lotternumber[0]==lotternumber[2] && lotternumber[1]==lotternumber[2] ){
									leopard="豹子"
								}else{
									leopard=""
								}
								html2+="<td>"+oddEven+"</td><td>"+size+"</td><td>"+boson+"</td><td>"+extreme+"</td><td>"+leopard+"</td>"
							} 
							html2+="</tr>"
					}
				
				$("thead").find("tr").eq(0).append(html)
				$("thead").find("tr").eq(1).append(html1)
				$("tfoot").find("tr").eq(1).append(html)
				$("tfoot").find("tr").eq(0).append(html1)
				if(cname.indexOf("28")!=-1){
					$("thead").find("tr").eq(0).append("<td rowspan='2'>单双</td><td rowspan='2'>大小</td><td rowspan='2'>波色</td><td rowspan='2'>极值</td><td rowspan='2'>豹子</td>")
					$("tfoot").find("tr").eq(0).append("<td rowspan='2'>单双</td><td rowspan='2' >大小</td><td rowspan='2'>波色</td><td rowspan='2'>极值</td><td rowspan='2'>豹子</td>")
				}
				$("tbody").append(html2)
				if($("tbody").html()==""){
					$("tbody").html("<tr><td colspan='10000'><div>占无数据</div></td></tr>")
				}
				//彩种的位数
				width=$("#chartsTable").width()
				height=$("#chartsTable").height()
				 var canvas=document.getElementById('canvas_div');
				canvas.setAttribute('width',width);
				canvas.setAttribute('height',height); 
			  document.querySelector("#canvas_div").getContext("2d").clearRect(0,0,width,height); 
				for(i=0;i<weishu.length;i++){
					var item=weishu[i];
					 bindtrendChat(item)
				}
			}else if(cname.indexOf("kl10f")!=-1){   //快乐十分的走势图
				var html2="";
				var html3="";
				
				$("thead").find("tr").eq(0).append("<td rowspan='2' class='jiangqi'>期号</td><td rowspan='2' colspan='8'>开奖号码</td>")
				$("tfoot").find("tr").eq(0).append("<td rowspan='2' class='jiangqi'>期号</td><td rowspan='2' colspan='8'>开奖号码</td>")
			
					html+="<td rowspan='1' colspan='10'>小区</td><td rowspan='1' colspan='10'>大区</td><td rowspan='2' colspan='8'>跨度</td><td rowspan='1' colspan='9'>012路</td></tr>"
					for(j=0;j<2;j++){
						for(i=1;i<11;i++){
							html1+="<td  colspan='1'>"+i+"</td>"
							html2+="<td  colspan='1'>"+i+"</td>"
						}
					}
					html1+="<td rowspan='1' colspan='3' >0路</td><td  width=120px rowspan='1' colspan='3'>1路</td><td  rowspan='1' colspan='3'>2路</td></tr>"
					html2+="<td width=50px  rowspan='2' colspan='8'>跨度</td><td  rowspan='1' colspan='3'>0路</td><td  rowspan='1' colspan='3'>1路</td><td rowspan='1' colspan='3'>2路</td></tr>"
					html3+="<td rowspan='1' colspan='10'>小区</td><td rowspan='1' colspan='10'>大区</td><td  rowspan='1' colspan='9'>012路</td></tr>"
					$("thead").find("tr").eq(0).append(html)
					$("thead").find("tr").eq(1).append(html1)
					$("tfoot").find("tr").eq(1).append(html3)
					$("tfoot").find("tr").eq(0).append(html2)
					var html4=""
					for(i=0;i<data.data.length;i++){
						var lotternumber=data.data[i].lotternumber; 
						lotternumber=lotternumber.split(",")
						var zeroLu=[];
						var oneLu=[];
						var twoLu=[];
						for(j=0;j<lotternumber.length;j++){
							var item=lotternumber[j]
							if(item%3==0){
								zeroLu.push(item)
							}else if(item%3==1){
								oneLu.push(item)
							}else{
								twoLu.push(item)
							}
						}
						zeroLu=zeroLu.join(",")
						zeroLu=zeroLu.substring(0, zeroLu.length - 1)
						var maxN = eval("Math.max(" + lotternumber.toString() + ")");
						var minN = eval("Math.min(" + lotternumber.toString() + ")");
						html4+="<tr><td class='issue'><div class='issueinfo'>"+data.data[i].period+"</div></td>"
							for(j=0;j<8;j++){
								html4+="<td align='center' class='codetd'><div class='historycode'>"+lotternumber[j]+"</div></td>"
							}
						for(var z=1;z<21;z++){
								if(z<10){
									z="0"+z;
								}
								z+="";
								if(lotternumber.indexOf(z)!=-1){
									 if(z<11){ 
										html4+="<td class='charball td0' align='center'>"+
								           "<div class='ball01'>"+z+"</div>"+
									    "</td>"
								 	}
									else if(z<21){ 
										 html4+="<td class='charball td0' align='center'>"+
								           "<div class='ball01 ball01_yellow'>"+z+"</div>"+
										    "</td>"
									} 
									
								}else{
									html4+="<td class='wdh td0' align='center'>"+
							           " <div class='ball13 noWin'>"+z+"</div>"+
								          "</td>"
								}
								
							}
						html4+="<td align='center' colspan='8' class='bgColor'>"+(maxN-minN)+"</td>"
						html4+="<td align='center' colspan='3' class='bgColor'>"+zeroLu+"</td><td class='bgColor' align='center' colspan='3'>"+oneLu+"</td><td class='bgColor' align='center' colspan='3'>"+twoLu+"</td>"
						html4+="</tr>"
					}
					$("tbody").append(html4)
				 	document.querySelector("#canvas_div").getContext("2d").clearRect(0,0,width,height);  
				
			}else{    //六合彩的走势图
				var blueArr = ["03","04","09","10","14","15","20","25","26","31","36","37","41","42","47","48"]
				var redArr = ["01","02","07","08","12","13","18","19","23","24","29","30","34","35","40","45","46"]
				var greenArr = ["05","06","11","16","17","21","22","27","28","32","33","38","39","43","44","49"]
				var wanfaType=["平码","特码","总和","特码玩法"]
				var wanfa=["总数","单双","大小","七色波","单双","合单双","合大小","特头","特尾","五行"]
				var shengxiao=["鸡","猴","羊","马","蛇","龙","兔","虎","牛","鼠","猪","狗"]
			    var wuxing=["金","木","水","火","土"]
				var SXobj={
						"鸡":["02","14","26","38"],
						"猴":["03","15","27","39"],
						"羊":["04","16","28","40"],
						"马":["05","17","29","41"],
						"蛇":["06","18","30","42"],
						"龙":["07","19","31","43"],
						"兔":["08","20","32","44"],
						"虎":["09","21","33","45"],
						"牛":["10","22","34","46"],
						"鼠":["11","23","35","47"],
						"猪":["12","24","36","48"],
						"狗":["01","13","25","37","49"],
				}	
				var WXobj={
					"金":["04","05","18","19","26","27","34","35","48","49"],
					"木":["01","08","09","16","17","30","31","38","39","46","47"],
					"水":["06","07","14","15","22","23","36","37","44","45"],
					"火":["02","03","10","11","24","25","32","33","40","41"],
					"土":["12","13","20","21","28","29","42","43"]
				}
				 
				var html=""
				var html1=""
				var html2=""
				var html3=""
				$("thead").find("tr").eq(0).append("<td rowspan='2' class='jiangqi'>期号</td><td rowspan='2' colspan='7'>开奖号码</td>")
				$("tfoot").find("tr").eq(0).append("<td rowspan='2' class='jiangqi'>期号</td><td rowspan='2' colspan='7' width=80>开奖号码</td>")
				html+="<td rowspan='2' colspan='6'>平码</td><td rowspan='2'>特码</td><td rowspan='1' colspan='4'>总和</td><td rowspan='1' colspan='6'>特码玩法</td>"
				html2+="<td rowspan='2' colspan='6'>平码</td><td rowspan='2'>特码</td>"
				html3+="<td rowspan='1' colspan='4'>总和</td><td rowspan='1' colspan='6'>特码玩法</td>"
				for(i=0;i<wanfa.length;i++){
					html1+="<td>"+wanfa[i]+"</td>"
					html2+="<td>"+wanfa[i]+"</td>"
				}
				var AllLotterNumber="";
				var Allissue="";
				var Allsebo
				var shengxiao
				var html4=""
				for(i=0;i<data.data.length;i++){
					var	lotternumber=data.data[i].lotternumber;
					Allissue+=data.data[i].period+","
					AllLotterNumber+=lotternumber
					lotternumber=lotternumber.split(",")
					var AllNum=lotternumber.slice(0,lotternumber.length-1)
					var AlldanS
					var AlldaX
					AllNum=sum(AllNum)
					if(AllNum%2==0){
						AlldanS="双"
					}else{
						AlldanS="单"
					}
					
					if(AllNum>174){
						AlldaX="大"
					}else{
						AlldaX="小"
					}
					
					var zhengma=lotternumber.slice(0,lotternumber.length-2)
					var tema=lotternumber[lotternumber.length-2]
					lotternumber=lotternumber.join(" ")
					html4+="<tr><td class='issue'><div class='issueinfo'>"+data.data[i].period+"</div></td><td colspan='7' align='center' class='codetd'><div style='color:red'>"+lotternumber+"</div></td>"
					var lvqiu=0;
					var hongqiu=0;
					var lanqiu=0;
					for(j=0;j<zhengma.length;j++){
						var ZMitem
						var item=zhengma[j]
						
						if(blueArr.indexOf(item)!=-1){
							html4+="<td><div class='lanbo'>"+item+"</div>"
							lanqiu++
						}else if(greenArr.indexOf(item)!=-1){
							html4+="<td><div class='lvbo'>"+item+"</div>"
							lvqiu++
						}else{
							html4+="<td><div class='hongbo'>"+item+"</div>"
							hongqiu++
						}
						for(x=0;x<shengxiao.length;x++){
							ZMitem=shengxiao[x]
							if(SXobj[ZMitem].indexOf(item)!=-1){
								html4+="<div>"+ZMitem+"</div></td>"
							}
						}
					}
					
					var TMdanS
					if(Number(tema)%2==0){
						TMdanS="双"
					}else{
						TMdanS="单"
					}
					
					var TMwei=Number(tema)%10
					var TMtou=parseInt(Number(tema)/10)
					var TMHedanS
					var TMHedaX
					var TMwuH
					if((TMtou+TMwei)%2==0){
						TMHedanS="合双"
					}else{
						TMHedanS="合单"
					}
					 if(TMtou+TMwei>6){
						 TMHedaX="合大"
					 }else{
						 TMHedaX="合小"
					 }
					
					if(blueArr.indexOf(tema)!=-1){
						html4+="<td><div class='lanbo'>"+tema+"</div>"
						lanqiu++
					}else if(greenArr.indexOf(tema)!=-1){
						html4+="<td><div class='lvbo'>"+tema+"</div>"
						lvqiu++
					}else{
						html4+="<td><div class='hongbo'>"+tema+"</div>"
						hongqiu++
					}
					Allsebo=Math.max(hongqiu,lanqiu,lvqiu)
					if(hongqiu==Allsebo){
						Allsebo="红波"
					}else if(lanqiu==Allsebo){
						Allsebo="蓝波"
					}else if(lvqiu==Allsebo){
						Allsebo="绿波"
					}
					var TMitem
					for(y=0;y<shengxiao.length;y++){
							TMitem=shengxiao[y]
							if(SXobj[TMitem].indexOf(tema)!=-1){
								html4+="<div>"+TMitem+"</div></td>"
							}
					}
					html4+="<td>"+AllNum+"</td><td>"+AlldanS+"</td><td>"+AlldaX+"</td><td>"+Allsebo+"</td>"
					html4+="<td>"+TMdanS+"</td><td>"+TMHedanS+"</td><td>"+TMHedaX+"</td><td>"+TMtou+"</td><td>"+TMwei+"</td>"
					 for(y=0;y<wuxing.length;y++){
						TMwuH=wuxing[y]
						if(WXobj[TMwuH].indexOf(tema)!=-1){
							html4+="<td><div>"+TMwuH+"</div></td>"
						}
					} 
				}
				$("thead").find("tr").eq(0).append(html)
				$("thead").find("tr").eq(1).append(html1)
				$("tfoot").find("tr").eq(1).append(html3)
				$("tfoot").find("tr").eq(0).append(html2)
				$("tbody").append(html4)
			    document.querySelector("#canvas_div").getContext("2d").clearRect(0,0,width,height); 
			}
		}
	})
			
}


//数组拆分
function split_array(arr,len){//arr为要拆分的原数组，len小数组包含多少元素
	var arr_len=arr.length;
	var result=[];    //结果数组
	for(i=0;i<arr_len;i+=len){
		result.push(arr.slice(i,i+len))
	}
	return result  
}  
//数组求和
function sum(arr) {
    var s = 0;
    for (var i=0; i<arr.length; i++) {
        s += Number(arr[i]);
    }
    return s;
}


//遍历同类型的彩种
function newActiveItem(item) {///cp/src/main/webapp/img/caizhong/cqkl10f.png
		var html ="<li>"+
			        " <a>"+
			           "<span class='"+item.cname+"'>"+item.name+"</span>"+
			         "</a>"+
			         "<em>|</em>"+
			      "</li>"
      return html
	}


//canvas画线
function drwaLine(x1,y1,x2,y2,linecolor){
	var selfHeight=(document.documentElement.clientWidth * 0.055);
	if(selfHeight>22){
		selfHeight=22
	}
	selfHeight=selfHeight/2
	var CANVAS_CONTEXT=document.querySelector("#canvas_div").getContext("2d")
	CANVAS_CONTEXT.lineWidth = 1
	CANVAS_CONTEXT.lineJoin = "round" //是 canvas 画板让笔更加连续
	CANVAS_CONTEXT.lineCap = "round"
	CANVAS_CONTEXT.stfillStyle = linecolor
    CANVAS_CONTEXT.strokeStyle = linecolor
    CANVAS_CONTEXT.beginPath(); 
	CANVAS_CONTEXT.moveTo(x1, y1) // 起点
    CANVAS_CONTEXT.lineTo(x2, y2) // 终点
    CANVAS_CONTEXT.stroke()
    CANVAS_CONTEXT.closePath()
}
	

	
	//走势图
	 function bindtrendChat(weishu){
		var allHighLightItems=document.querySelectorAll("."+weishu)
		var linecolor=$(allHighLightItems).css('background-color')
		var canvas=$("#canvas_div").offset()
		for(var j=0;j<allHighLightItems.length;j++){
			if((j+1)==allHighLightItems.length){
				break
			}
				drwaLine($(allHighLightItems[j]).offset().left-canvas.left+12,$(allHighLightItems[j]).offset().top-canvas.top+12,$(allHighLightItems[j + 1]).offset().left-canvas.left+12,$(allHighLightItems[j + 1]).offset().top-canvas.top+12,linecolor)
		}
	} 
	
	/* 彩种切换  */
	var bindDrawSwitch=function(){
		$(".lotteryNav .liDiv").on("click",function(){
			var data = $("div").data(data).newData;
			$(this).addClass("active").siblings("li").removeClass("active"); 
			var caizhong=$(this).attr("class").split(" ")[1]
			var $noticeList = $(".hideNav ul")
			$noticeList.html(" "); 
			var html="";
			for(var i = 0;i < data.data.length;i++){
				var arr = data.data[i].classt.split(" ")
				  if(arr[2] == caizhong){
					 html += newActiveItem(data.data[i])
				} 
			}
		     $noticeList.append(html) 
		     bindLotterSwith()
		})
	}
	
	var bindLotterSwith=function(){
		$(".hideNav").find("span").on("click",function(){
			$(this).addClass("active").parent().parent().siblings("li").find("span").removeClass("active")
			 cname=$(this)[0].className.split(" ")[0]
			 bindCaiZhongjl()
		}) 
	}
	
	$(".codeNav a").on("click",function(){
		$(this).addClass("active").siblings().removeClass("active")
		index=$(this).index()+1
		bindCaiZhongjl()
	})
	
	//查询走势图
	
	bindDrawSwitch()
</script>

